<template>
  <RouterView />

  <van-tabbar v-model="active" route v-show="$route.meta.showTabbar == true">
    <van-tabbar-item icon="wap-home-o" to="/">商城</van-tabbar-item>
    <van-tabbar-item icon="newspaper-o" to="/class">分类</van-tabbar-item>
    <van-tabbar-item icon="shopping-cart-o" to="/cart" :badge="cartArr.length"
      >购物车</van-tabbar-item
    >
    <van-tabbar-item icon="contact-o" to="/my">我的</van-tabbar-item>
  </van-tabbar>
</template>

<script setup>
import { ref } from "vue"
import { cartArr, loadCartList } from "./stores/cartlist"
let active = ref(0)
let token = localStorage.getItem("token")
if (token) loadCartList()
</script>

<style scoped></style>
